{template 'common/header'}
{template 'common'}
<div class="main">
	<ul class="nav nav-tabs">
     	<li><a href="{php echo $this->createWebUrl('reserve');}">订单管理</a></li>
     	<li class="active"><a href="{php echo $this->createWebUrl('reserve',array('op'=>'edit','id'=>$id));}">订单处理</a></li>
	</ul>
	<form action="" class="form-horizontal form" method="post" enctype="multipart/form-data" onsubmit="return formcheck();">
    <input type="hidden" name="id" value="{$id}">
    <input type="hidden" name="oldstatus" id="oldstatus" value="{$item['reserve_stauts']}">
 	<div class="panel panel-default">
     	<div class="panel-heading">学员信息</div>
        <div class="panel-body">
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">姓名</label>
				<div class="col-sm-9 col-xs-12  form-control-static">{$item['username']}</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">手机</label>
				<div class="col-sm-9 col-xs-12  form-control-static">
					{$item['mobile']}
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">邮箱</label>
				<div class="col-sm-9 col-xs-12  form-control-static">
					{$item['email']}
				</div>
			</div>
    	</div>
 	</div>
    <div class="panel panel-default">
     	<div class="panel-heading">课程信息</div>
		<div class="panel-body">
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">课程标题</label>
				<div class="col-sm-9 col-xs-12  form-control-static">
					{$item['title']}
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">报名限制</label>
				<div class="col-sm-9 col-xs-12  form-control-static">
					{if $item['ctype'] == 1}人数限制{else}时间限制{/if}
				</div>
			</div>
			{if $item['ctype'] == 1}
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">限制人数</label>
				<div class="col-sm-9 col-xs-12 form-control-static">
					{$item['ctotal']}人
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">报名人数</label>
				<div class="col-sm-9 col-xs-12 form-control-static">
					{$item['fansnum']}人
				</div>
			</div>
			{else}
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">报名时间</label>
				<div class="col-sm-9 col-xs-12   form-control-static">
					{php echo date('Y年m月d日 H:i',$item['starttime'])} 至 {php echo date('Y年m月d日 H:i',$item['endtime'])}
				</div>
			</div>
			{/if}
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">授课讲师</label>
				<div class="col-sm-9 col-xs-12  form-control-static">
					{$item['teachers']}
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">授课开始时间</label>
				<div class="col-sm-9 col-xs-12  form-control-static">  {php echo date('Y年m月d日 H:i',$item['coursetime'])}</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">授课时长</label>
				<div class="col-sm-9 col-xs-12  form-control-static">  {$item['times']}分钟</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">订单时间</label>
				<div class="col-sm-9 col-xs-12  form-control-static">
					{php echo date("Y-m-d H:i:s",$item['reserve_createtime']); }
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">操作</label>
				<div class="col-sm-9 col-xs-12">
					<select name="status" class="form-control" id="status">
						<option value="0" {if $item['reserve_stauts'] == 0 } selected="selected"{/if}>等待确认</option>
						<option value="-1" {if $item['reserve_stauts'] == -1 } selected="selected"{/if}>订单取消</option>
						<option value="1" {if $item['reserve_stauts'] == 1 } selected="selected"{/if}>订单确认</option>
						<option value="2" {if $item['reserve_stauts'] == 2 } selected="selected"{/if}>订单拒绝</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">备注</label>
				<div class="col-sm-9 col-xs-12">
					<textarea style="height:100px;" class="form-control richtext-clone" name="msg" cols="70" id="reply-add-text">{$item['msg']}</textarea>
				</div>
			</div>
		</div>
 	</div>
    <div class="form-group col-sm-12">
		<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
		<input type="hidden" name="token" value="{$_W['token']}" />
    </div>
</form>
<script language="JavaScript">
    function formcheck(){
        var ok = true;
        {if $item['ctype'] == 1}
            var ctotal = {$item['ctotal']};
            var fansnum= {$item['fansnum']};
            var oldstatus = $("#oldstatus").val();
            var status = $("#status").val();
            if (status == 1 && oldstatus != 1) {
                if (fansnum >= ctotal) {
                    alert("预定人数已满，无法进行订单确认");
                    ok =false;
                    return false;
                }
            }
        {/if}
        return ok;
    }
</script>
{template 'common/footer'}
